package com.saturday.utils;

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

import java.util.Set;

public final class PathUtil {

    private PathUtil() {
    }

    public static boolean pathMatcher(String uri, Set<String> urlSet) {
        if (urlSet.contains(uri)) {
            return true;
        }
        PathMatcher pathMatcher = new AntPathMatcher();
        for (String pattern : urlSet) {
            if (pathMatcher.match(pattern, uri)) {
                return true;
            }
        }
        return false;
    }
}
